<template>
  <div class="like-page">
    <van-nav-bar fixed title="我的点赞" />
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <ArticleItem v-for="(item, i) in list" :key="i" :item="item" />
    </van-list>
  </div>
</template>

<script>
import { like } from '../api/article.js'
export default {
  name: 'LikeView',
  data () {
    return {
      page: 1,
      list: [],
      loading: false,
      finished: false
    }
  },
  async created () {},
  methods: {
    async onLoad () {
      const res = await like({ page: this.page })
      console.log(res)
      this.list.push(...res.data.rows)
      this.page++
      this.loading = false
      if (this.page > res.data.rows) {
        this.finished = true
      }
    }
  }
}
</script>

<style lang="less" scoped>
.like-page {
  margin-bottom: 50px;
  margin-top: 44px;
}
</style>
